import { request } from '../service'

export interface signInDataType {
  account: string
  password: string
}

const signIn = (data: signInDataType) =>
  request({
    method: 'POST',
    url: '/sign/in',
    data,
  })

const getUserInfo = (data: { account: string }) =>
  request({
    method: 'POST',
    url: '/sign/info',
    params: data,
  })

const signOut = ({ account }: { account: string }) =>
  request({
    method: 'GET',
    url: '/sign/out',
    params: {
      account,
    },
  })

const getKeyPair = () =>
  request({
    method: 'GET',
    url: '/sign/keyPair',
  })

export default {
  signIn,
  getUserInfo,
  signOut,
  getKeyPair,
}
